package com.example.flow.flow.core;

import com.example.flow.dao.model.FlowOrder;
import com.example.flow.dao.model.FlowProcess;
import com.example.flow.dao.model.FlowTask;
import lombok.Data;

import java.io.Serializable;
import java.util.Map;

/**
 * 流程执行对象 包括流程定义、流程模型、流程实例对象、执行参数
 *
 * @author tangaq
 * 2023/6/13
 */
@Data
public class Execution implements Serializable {
    private static final long serialVersionUID = -700041011539795790L;

    private FlowEngine engine;
    /**
     * 流程定义对象
     */
    private FlowProcess process;
    /**
     * 流程工单
     */
    private FlowOrder order;

    /**
     * 操作人
     */
    private String operate;
    /**
     * 执行参数
     */
    private Map<String, Object> args;

    private FlowTask task;

    public Execution() {
    }

    public Execution(FlowEngine engine, FlowProcess process, FlowOrder order, Map<String, Object> args) {
        if (process == null || order == null) {
            throw new RuntimeException("构造Execution对象失败，请检查process、order是否为空");
        }
        this.engine = engine;
        this.process = process;
        this.order = order;
        this.args = args;
    }
}
